package com.leyou.trade.utils;

import com.leyou.auth.dto.UserDetail;


public class CookieContext {

    private static final ThreadLocal<String> TL = new ThreadLocal<>();

    /**
     * 存储一个请求的cookie到当前线程
     * @param cookie cookie信息
     */
    public static void setCookie(String cookie) {
        TL.set(cookie);
    }

    /**
     * 从当前线程获取一个Cookie
     * @return 用户信息
     */
    public static String getCookie() {
        return TL.get();
    }

    /**
     * 从当前线程移除cookie
     */
    public static void removeCookie() {
        TL.remove();
    }
}